

#ifndef UD_DBMLINE_H
#define UD_DBMLINE_H

#include "zdbmain.h"

#pragma pack(push, 8)

struct Mline
{
    typedef ZSoft::Int8 MlineJustification;
    enum {
        kTop        = 0,
        kZero       = 1,
        kBottom     = 2
    };
    enum {
        kOpen         = 0,
        kClosed       = 1,
        kMerged       = 2
    };
};

class UcGePlane;

class UcDbMline: public  UcDbEntity
{
public:
    UCDB_DECLARE_MEMBERS(UcDbMline);
    UcDbMline();
    virtual ~UcDbMline();

    Ucad::ErrorStatus setStyle(const UcDbObjectId &newStyleId);
    UcDbObjectId      style() const;

    Ucad::ErrorStatus setJustification(Mline::MlineJustification newJust);
    Mline::MlineJustification justification() const;

    Ucad::ErrorStatus setScale(double newScale);
    double            scale() const;

    UcGeVector3d      normal            () const;
    Ucad::ErrorStatus setNormal(const UcGeVector3d & newNormal);

    Ucad::ErrorStatus appendSeg(const UcGePoint3d& newVertex);
    Ucad::ErrorStatus removeLastSeg(UcGePoint3d& lastVertex);

    Ucad::ErrorStatus moveVertexAt(int index, const UcGePoint3d& newPosition);

    Ucad::ErrorStatus setClosedMline(bool closed);
    bool              closedMline() const;

    void              setSupressStartCaps(bool supressIt);
    bool              supressStartCaps() const;
    void              setSupressEndCaps(bool supressIt);
    bool              supressEndCaps() const;

    int               numVertices() const;
    int               element(const UcGePoint3d & pt) const;
    UcGePoint3d       vertexAt(int index) const;

    UcGeVector3d      axisAt(int index) const;
    UcGeVector3d      miterAt(int index) const;
    Ucad::ErrorStatus getParametersAt(int index,
                                      UcGeVoidPointerArray& params) const;
    Ucad::ErrorStatus setParametersAt(int index,
                                            UcGeVoidPointerArray& params);

    void              list() const;
    Ucad::ErrorStatus getClosestPointTo(
                         const UcGePoint3d& givenPoint,
                         UcGePoint3d& pointOnCurve,
                         bool extend,
                         bool excludeCaps = false) const;
    Ucad::ErrorStatus getClosestPointTo(
                         const UcGePoint3d& givenPoint,
                         const UcGeVector3d& normal,
                         UcGePoint3d& pointOnCurve,
                         bool extend,
                         bool excludeCaps = false) const;

    void              getPlane(UcGePlane&) const;
    Ucad::ErrorStatus getGeomExtents(UcDbExtents&) const;

    Ucad::ErrorStatus getSubentPathsAtGsMarker(
                         UcDb::SubentType      type,
                         ZSoft::GsMarker       gsMark,
                         const UcGePoint3d&    pickPoint,
                         const UcGeMatrix3d&   viewXform,
                         int&                  numPaths,
                         UcDbFullSubentPath*&  subentPaths,
                         int                   numInserts = 0,
                         UcDbObjectId*         entAndInsertStack = NULL) const;

    Ucad::ErrorStatus getGsMarkersAtSubentPath(const UcDbFullSubentPath& subPath,
                                               UcArray<ZSoft::GsMarker>& gsMarkers) const;

    UcDbEntity*       subentPtr(const UcDbFullSubentPath& id) const;

    virtual Ucad::ErrorStatus getClassID(CLSID* pClsid) const;
};

#pragma pack(pop)

#endif
